package org.window;

import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import org.openProcess.StageWindowsProcess;
import org.sponsorship.StageWindowsSponsorship;

/**
 * 内存读写测试
 */
public class PaneControllerAndHBoxStateAndButtonSponsorship {
    public static Button button = new Button();
    public static void init(){
        button.setText("赞助作者");
        button.setPrefWidth(80);
        button.setPrefHeight(20);
        button.setBackground(new Background(new BackgroundImage(new Image("bgk.jpg"), BackgroundRepeat.NO_REPEAT ,BackgroundRepeat.REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT)));
        button.setStyle("-fx-text-fill: #ffffff");
//        button.setDisable(true);
        button.setOnMouseEntered(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                button.setBackground(new Background(new BackgroundImage(new Image("bgk2.jpg"), BackgroundRepeat.NO_REPEAT ,BackgroundRepeat.REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT)));
            }
        });
        button.setOnMouseExited(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                button.setBackground(new Background(new BackgroundImage(new Image("bgk.jpg"), BackgroundRepeat.NO_REPEAT ,BackgroundRepeat.REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT)));
            }
        });
        button.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                StageWindowsSponsorship.stage.show();
            }
        });
    }
}
